package net.xuele.learn.testClass;

import com.zaxxer.hikari.util.FastList;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by huanghao（HIKARI） on 2019/7/25 0025.
 */
public abstract class Demo {
    int width;

    public Demo(int i) {
        this.width = i;
    }

    public static void main(String[] args) {
        String str = "this is:";
        int i = 10;
        System.out.println(str + 20 + i);
        System.out.println((str + 20) + i);// this is 2010
        System.out.println(str + (20 + i)); // this is 30

        String s1 = new String("123");
        String s2 = new String("123");
        Map<String,String> map = new HashMap<>();
        map.put(s1,"abc");
        System.out.println(s1.equals(s2));
        System.out.println(map.get(s2));

        String s3 = "1";
        String s4 = new String("1");

        System.out.println(s3 == s4);

        Integer i1 = Integer.parseInt("127");
        Integer i2 = Integer.parseInt("127");
        Integer i3 = Integer.parseInt("128");

        System.out.println("---------");
        System.out.println(i1.equals(i2));
        System.out.println(i1 == i3);
        System.out.println(i2 == i3);

        System.out.println("-------------");
        // 9,6,25,251
        System.out.println(9/10);
        System.out.println(15/10);
        System.out.println(151/10);


        System.out.println("------------=========");
        StringBuilder sb1 = new StringBuilder("A");
        StringBuilder sb2 = new StringBuilder("B");
        append(sb1,sb2);
        System.out.println(sb1+","+sb2);
        int[] a1 = new int[3];
        for (int j = 0; j < a1.length; j++) {
            a1[j] = j+1;
        }
        arr(a1);
        for (int j = 0; j < a1.length; j++) {
            System.out.println(a1[j]);
        }
    }

    private static void arr(int[] a1) {
        a1[0] = 9;
    }

    public static void append(StringBuilder x, StringBuilder y) {
        x.append(y);
        y = x;
    }
}
